﻿/*******************************************************************************
* KindEditor - WYSIWYG HTML Editor for Internet
* Copyright (C) 2006-2011 kindsoft.net
*
* @author luodaishi 20151015
* @site http://www.kindsoft.net/
* @licence http://www.kindsoft.net/license.php
*******************************************************************************/

KindEditor.plugin('video', function (K) {
    var self = this, name = 'video', lang = self.lang(name + '.');
		//allowMediaUpload = K.undef(self.allowMediaUpload, true),
		//allowFileManager = K.undef(self.allowFileManager, false),
		//formatUploadUrl = K.undef(self.formatUploadUrl, true),
		//extraParams = K.undef(self.extraFileUploadParams, {}),
		//filePostName = K.undef(self.filePostName, 'imgFile'),
    //uploadJson = K.undef(self.uploadJson, self.basePath + 'php/upload_json.php');
    uploadJson = self.uploadJson;
    self.clickToolbar('video', function () {
        var html = [
				'<div style="padding:20px;">',
				//url
				'<div class="ke-dialog-row">',
				'<label for="keUrl" style="width:60px;">' + 'url' + '</label>',
				'<input class="ke-input-text" type="text" id="keUrl" name="url" value="" style="width:160px;" /> &nbsp;',
				'<input type="button" class="ke-upload-button" value="' + '上传视频' + '" /> &nbsp;',
				'<span class="ke-button-common ke-button-outer">',
				//'<input type="button" class="ke-button-common ke-button" name="viewServer" value="' + lang.viewServer + '" />',
				'</span>',
				'</div>',
				//width
				'<div class="ke-dialog-row">',
				'<label for="keWidth" style="width:60px;">' + '宽度' + '</label>',
				'<input type="text" id="keWidth" class="ke-input-text ke-input-number" name="width" value="550" maxlength="4" />',
				'</div>',
				//height
				'<div class="ke-dialog-row">',
				'<label for="keHeight" style="width:60px;">' + '高度' + '</label>',
				'<input type="text" id="keHeight" class="ke-input-text ke-input-number" name="height" value="400" maxlength="4" />',
				'</div>',
				//autostart
				'<div class="ke-dialog-row">',
				//'<label for="keAutostart">' + '自动播放' + '</label>',
				//'<input type="checkbox" id="keAutostart" name="autostart" value="" /> ',
				'</div>',
				'</div>'
        ].join('');
        var dialog = self.createDialog({
            name: name,
            width: 450,
            height: 230,
            title: self.lang(name),
            body: html,
            yesBtn: {
                name: self.lang('yes'),
                click: function (e) {
                    //var url = K.trim(urlBox.val()),
                    //    width = widthBox.val(),
                    //    height = heightBox.val();
                    //if (url == 'http://' || K.invalidUrl(url)) {
                    //    alert(self.lang('invalidUrl'));
                    //    urlBox[0].focus();
                    //    return;
                    //}
                    //if (!/^\d*$/.test(width)) {
                    //    alert(self.lang('invalidWidth'));
                    //    widthBox[0].focus();
                    //    return;
                    //}
                    //if (!/^\d*$/.test(height)) {
                    //    alert(self.lang('invalidHeight'));
                    //    heightBox[0].focus();
                    //    return;
                    //}
                    //var html = K.mediaImg(self.themesPath + 'common/blank.gif', {
                    //    src: url,
                    //    type: K.mediaType(url),
                    //    width: width,
                    //    height: height,
                    //    autostart: autostartBox[0].checked ? 'true' : 'false',
                    //    loop: 'true'
                    //});
                    //self.insertHtml(html).hideDialog().focus();
                }
            }
        })
    });
});
